package com.ruoyi.info.service.impl;

import java.util.List;
import java.util.Map;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.stereotype.Service;
import com.ruoyi.info.mapper.VinfoDriverMapper;
import com.ruoyi.info.domain.VinfoDriver;
import com.ruoyi.info.service.IVinfoDriverService;

import javax.annotation.Resource;

/**
 * 驾驶人信息Service业务层处理
 *
 * @author oy
 * @date 2022-12-16
 */
@Service
public class VinfoDriverServiceImpl implements IVinfoDriverService
{
    @Resource
    private VinfoDriverMapper vinfoDriverMapper;

    /**
     * 查询驾驶人信息
     *
     * @param driverId 驾驶人信息主键
     * @return 驾驶人信息
     */
    @Override
    public VinfoDriver selectVinfoDriverByDriverId(Long driverId)
    {
        return vinfoDriverMapper.selectVinfoDriverByDriverId(driverId);
    }

    /**
     * 查询驾驶人信息列表
     *
     * @param vinfoDriver 驾驶人信息
     * @return 驾驶人信息
     */
    @Override
    public List<VinfoDriver> selectVinfoDriverList(VinfoDriver vinfoDriver)
    {
        return vinfoDriverMapper.selectVinfoDriverList(vinfoDriver);
    }

    /**
     * 新增驾驶人信息
     *
     * @param vinfoDriver 驾驶人信息
     * @return 结果
     */
    @Override
    public int insertVinfoDriver(VinfoDriver vinfoDriver)
    {
        return vinfoDriverMapper.insertVinfoDriver(vinfoDriver);
    }

    /**
     * 修改驾驶人信息
     *
     * @param vinfoDriver 驾驶人信息
     * @return 结果
     */
    @Override
    public int updateVinfoDriver(VinfoDriver vinfoDriver)
    {
        vinfoDriver.setUpdateTime(DateUtils.getNowDate());
        return vinfoDriverMapper.updateVinfoDriver(vinfoDriver);
    }

    /**
     * 批量删除驾驶人信息
     *
     * @param driverIds 需要删除的驾驶人信息主键
     * @return 结果
     */
    @Override
    public int deleteVinfoDriverByDriverIds(Long[] driverIds)
    {
        return vinfoDriverMapper.deleteVinfoDriverByDriverIds(driverIds);
    }

    /**
     * 删除驾驶人信息信息
     *
     * @param driverId 驾驶人信息主键
     * @return 结果
     */
    @Override
    public int deleteVinfoDriverByDriverId(Long driverId)
    {
        return vinfoDriverMapper.deleteVinfoDriverByDriverId(driverId);
    }

    /**
     * 查询驾驶人id和姓名列表
     * @return
     */
    public List<Map<String,Object>> getDriverIdAndNameList(String name){
        return vinfoDriverMapper.getDriverIdAndNameList(name);
    }
}
